import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Vector;

import javax.swing.JButton;

import Framework.*;


public class win_Scratchpad extends pnl_Ancestor implements ActionListener{
	static String CLASS = "scratchpad";
	
	btn_Ancestor btn_DrawDialogue = new btn_Ancestor("Draw a dialogue!");
	dlg_basicDialogTest myDlg;
	
	dlg_Keyboard dlg_alphaKeyboard;
	dlg_Keyboard dlg_NumericKeyboard;
	
	JLabel myCount = new JLabel("Watch me change!");
	JLabel keyboard = new JLabel("Ima keyboard");
	
	btn_Ancestor btn_NumericKeyboard = new btn_Ancestor("Numeric Keyboard");
	btn_Ancestor btn_alphaKeyboard = new btn_Ancestor("Keyboard");
	
	btn_Ancestor btn_Str1 = new btn_Toggle(".");
	btn_Ancestor btn_Str2 = new btn_Toggle(".123");
	btn_Ancestor btn_Str3 = new btn_Toggle(".123456");
	btn_Ancestor btn_Str4 = new btn_Toggle(".1234567890");
	btn_Ancestor btn_Str5 = new btn_Toggle(".1234567890123");
	btn_Ancestor btn_Str6 = new btn_Toggle(".1234567890123456");
	btn_Ancestor btn_Str7 = new btn_Toggle(".12345678901237890");
	btn_Ancestor btn_Str8 = new btn_Toggle(".123456789012378901234567890", "hero?");
	
	win_Scratchpad(){
		super();
		this.setSize(800,600);
		btn_Ancestor myButton = new btn_Ancestor("Hello World");
		btn_Ancestor myButton2 = new btn_Ancestor("Hello World2");
		btn_Ancestor myButton3 = new btn_Ancestor("Hello World3");
		
		this.setLayout(null);
		
		Vector <JButton> x = new Vector<JButton>();
		x.add(myButton);
		x.add(myButton2);
		x.add(myButton3);
		x.add(myButton3);
		x.add(myButton3);
		
		pnl_Scrollable myScroll = new pnl_Scrollable(new Rectangle(0,0,300,600), new Rectangle(0,0,900, 1800), true);
		this.add(myScroll);
		//btn_DrawDialogue.setBounds(300, 300, 100, 100);
		
		//myCount.setBounds(100,100,100,100);
		//this.add(btn_DrawDialogue);
		
		//keyboard.setBounds(100,130,100,100);
		//this.add(keyboard);
		
		//btn_DrawDialogue.addActionListener(this);
		//myDlg = new dlg_basicDialogTest();
		//myCount.setBounds(250,100,100,100);
		//this.add(myCount);		
		btn_Str1.setBounds(0, 100, 300, 100);
		this.add(btn_Str1);
		btn_Str2.setBounds(0, 200, 300, 100);
		this.add(btn_Str2);
		btn_Str3.setBounds(0, 300, 300, 100);
		this.add(btn_Str3);
		btn_Str4.setBounds(0, 400, 300, 100);
		this.add(btn_Str4);
		btn_Str5.setBounds(350,	100, 300, 100);
		this.add(btn_Str5);
		btn_Str6.setBounds(350, 200, 300, 100);
		this.add(btn_Str6);
		btn_Str7.setBounds(350, 300, 300, 100);
		this.add(btn_Str7);
		btn_Str8.setBounds(350, 400, 300, 100);
		this.add(btn_Str8);
		/*
		dlg_alphaKeyboard 		= new dlg_Keyboard("Hero?", false);
		dlg_NumericKeyboard 	= new dlg_Keyboard("Hero?", true);
		
		btn_NumericKeyboard.setBounds(350,100,100,100);
		btn_alphaKeyboard.setBounds(450,100,100,100);
		
		btn_alphaKeyboard.addActionListener(this);
		btn_NumericKeyboard.addActionListener(this);
		this.add(btn_NumericKeyboard);
		this.add(btn_alphaKeyboard);
		*/
		this.repaint();
		
	}
	public void callback(){
		System.out.println("Hero? Is this dialogue calling?");
		
	}
	public void actionPerformed(ActionEvent e) {
		String METHOD = "actionPerformed()";
		Object ActionSource = e.getSource();
		
		System.out.println(btn_DrawDialogue.equals(e.getSource()));
		
		if (btn_DrawDialogue.equals(ActionSource) ) {
			myDlg.activate(this);
			System.out.println("Im out of myDlg.");
			
		} else if (e.getClass().equals(myDlg.getClass()) && myDlg.equals(ActionSource)){
			// myDlg has called back! 
			myCount.setText(Integer.toString(myDlg.YesCount));
		} else if (btn_NumericKeyboard.equals(ActionSource)){
			dlg_alphaKeyboard.activate(this);
		} else if (btn_alphaKeyboard.equals(ActionSource)){
			dlg_NumericKeyboard.activate(this);
		} else {
			System.out.println("Where the *fuck* did that come from?");
		}
		
		
		 
	//	debugMessage.log(CLASS + "." + METHOD + " Called.", 11);
		
		//if e.getSource() == myButton.
		
	}

}
